﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test.Utility.Extensions
{
    public static class ExceptionExtensions
    {
        public static void GetExceptionInfos(this Exception ex, out string exMessage)
        {
            exMessage = string.IsNullOrWhiteSpace(ex.Message)
                            ? ex.Message
                            : "\r\n\r\n" + ex.Message;
            exMessage += "\r\n\r\n" + ex.StackTrace;
            if (ex.InnerException != null)
            {
                GetExceptionInfos(ex.InnerException, out exMessage);
            }
        }
    }
}
